/**
 */
package com.dingpeikeji.quickdeer.core.modules.cusmanage.web;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import com.dingpeikeji.quickdeer.core.common.config.Global;
import com.dingpeikeji.quickdeer.core.common.persistence.Page;
import com.dingpeikeji.quickdeer.core.common.utils.DateUtils;
import com.dingpeikeji.quickdeer.core.common.utils.StringUtils;
import com.dingpeikeji.quickdeer.core.common.web.BaseController;
import com.dingpeikeji.quickdeer.core.modules.cupons.dao.TCuponsDao;
import com.dingpeikeji.quickdeer.core.modules.cupons.entity.CuponsInfo;
import com.dingpeikeji.quickdeer.core.modules.cupons.service.TCuponsService;
import com.dingpeikeji.quickdeer.core.modules.driver.entity.TDrivers;
import com.dingpeikeji.quickdeer.core.modules.line.entity.TLine;
import com.dingpeikeji.quickdeer.core.modules.line.service.TLineService;
import com.dingpeikeji.quickdeer.core.modules.orders.entity.TOrders;
import com.dingpeikeji.quickdeer.core.modules.orders.service.TOrdersOutService;
import com.dingpeikeji.quickdeer.core.modules.orders.service.TOrdersService;
import com.dingpeikeji.quickdeer.core.modules.site.entity.TSitedtl;
import com.dingpeikeji.quickdeer.core.modules.site.service.TSitedtlService;
import com.dingpeikeji.quickdeer.core.modules.sys.entity.Office;
import com.dingpeikeji.quickdeer.modules.realsche.service.FRealscheService;
import com.dingpeikeji.quickdeer.modules.rentproduct.entity.TCargotype;
import com.dingpeikeji.quickdeer.modules.rentproduct.service.TCargotypeService;
import com.dingpeikeji.quickdeer.modules.rentproduct.service.TDemandsService;
import com.dingpeikeji.quickdeer.modules.utils.ValidateTool;


/**
 * 优惠券Controller
 */
@Controller
@RequestMapping(value = "${adminPath}/cusmanage/tCusManage")
public class TCusmanageController extends BaseController {

	@Autowired
	private TOrdersService tOrdersService;

	@Autowired
	private TCargotypeService tCargotypeService;

	
	@RequestMapping(value = {"list", ""})
	public String list(TOrders tOrders, HttpServletRequest request, HttpServletResponse response, Model model) {
//		if (StringUtils.isEmpty(tOrders.getCreateDateQueryStart())
//				&& StringUtils.isEmpty(tOrders.getCreateDateQueryEnd())) {
//			tOrders.setCreateDateQueryStart(DateUtils.getDate("yyyy-MM-dd"));
//			tOrders.setCreateDateQueryEnd(DateUtils.getDate("yyyy-MM-dd"));
//		}
//		tOrders.setOrderstatus(TOrders.STATUS_PAY);
		
//		Page<TOrders> page = tOrdersService.findCusmanagePage(new Page<TOrders>(request, response), tOrders);
		List<TOrders> list = tOrdersService.findcus(tOrders);
		model.addAttribute("tOrders", tOrders);
		model.addAttribute("list", list);

		ArrayList<TCargotype> cartypelist = (ArrayList<TCargotype>) tCargotypeService.findalltypes();
		model.addAttribute("tCargotypeList", cartypelist);
		return "modules/cusmanage/cusManageList";
	}

	

}
